﻿@{
    ViewBag.Title = "Quản lý các trường học";
    Layout = "~/Views/Shared/BE/_Admin_Layout.cshtml";
}
<article class="module width_3_quarter">
<div id="SchoolTable"></div>
</article>

<script type="text/javascript">

    $(document).ready(function () {

        //Prepare jtable plugin
        $('#SchoolTable').jtable({
            //...
            selecting: true, //Enable selecting
            multiselect: false, //Allow multiple selecting
            selectingCheckboxes: true, //Show checkboxes on first column
            openChildAsAccordion: true,
            paging: true,
            pageSize: 10,
            defaultSorting: 'CreatedTime DESC',
            sorting: true,
            title: 'Danh sách các trường vi phạm',
            actions: {
                listAction: '@Url.Action("ListReportedSchool","SchoolManagement")',
                deleteAction: '@Url.Action("DeleteReportedSchool","SchoolManagement")',
                //updateAction: '/SchoolManagement/UpdateSchool',
                //createAction: '/SchoolManagement/CreateSchool'
            },
            fields: {
                ReportSchoolID: {
                    key: true,
                    create: false,
                    edit: false,
                    list: false,
                    width: '15%'
                },
                SchoolName: {
                    title: 'Tên trường',
                    width: '15%'
                },
                ReportContent: {
                    title: 'Nội dung vi phạm',
                    type: 'textarea',
                    width: '50%'
                },
                CreatedTime: {
                    title: 'Ngày gửi',
                    type: 'date',
                    displayFormat: 'dd-mm-yy'
                }
            }
        });
        
        //Re-load records when user click 'load records' button.
        $('#LoadRecordsButton').click(function (e) {
            e.preventDefault();
            $('#SchoolTable').jtable('load', {
                keywords: $('#name').val(),
            });
        });

        //Load person list from server
        $('#SchoolTable').jtable('load');
        
        //Delete selected students
        $('#DeleteAllButton').button().click(function () {
            var $selectedRows = $('#SchoolTable').jtable('selectedRows');
            $('#SchoolTable').jtable('deleteRows', $selectedRows);
        });
    });

</script>

<article class="module width_3_quarter">
<div id="SchoolCommentTable"></div>
</article>

<script type="text/javascript">

    $(document).ready(function () {

        //Prepare jtable plugin
        $('#SchoolCommentTable').jtable({
            //...
            selecting: true, //Enable selecting
            multiselect: true, //Allow multiple selecting
            selectingCheckboxes: true, //Show checkboxes on first column
            openChildAsAccordion: true,
            paging: true,
            pageSize: 10,
            defaultSorting: 'SchoolName DESC',
            sorting: true,

            title: 'Danh sách các bình luận vi phạm',
            actions: {
                listAction: '@Url.Action("ListReportedComment")',
                deleteAction: '@Url.Action("DeleteComment")',
                //updateAction: 'Url.Action("UpdateComment")'
                //createAction: '/SchoolManagement/CreateComment'
            },
            fields: {
                CommentID: {
                    key: true,
                    create: false,
                    edit: false,
                    list: false
                },
                SchoolName: {
                    title: 'Tên trường',
                    width: '15%',
                    edit: false
                },
                UserName: {
                    title: 'Người gửi',
                    edit: false
                },
                CommentContent: {
                    title: 'Nội dung',
                    type: 'textarea'
                },
                CreatedTime: {
                    title: 'Ngày gửi nhận xét',
                    type: 'date',
                    displayFormat: 'dd-mm-yy'
                }
            }
        });
        //Re-load records when user click 'load records' button.
        $('#LoadRecordsButton').click(function (e) {
            e.preventDefault();
            $('#SchoolCommentTable').jtable('load', {
                keywords: $('#name').val(),
            });
        });
        //Load person list from server
        $('#SchoolCommentTable').jtable('load');
        
        //Delete selected students
        $('#SchoolCommentTable #DeleteAllButton').button().click(function () {
            var $selectedRows = $('#SchoolCommentTable').jtable('selectedRows');
            $('#SchoolCommentTable').jtable('deleteRows', $selectedRows);
        });
    });

</script>
